package com.bwie.pojo;

import com.bwie.constant.YunParkingConstant;
import lombok.Data;

/**
 * @program: yun_parking
 * @ClassName Result
 * @description:
 * @author: wdd
 * @create: 2024-07-24 09:13
 * @Version 1.0
 **/
@Data
public class Result<T> {


    private Integer code;//123
    private String msg;//提示信息
    private T data;


    public static <T> Result<T> success() {
        Result<T> result = new Result<>();
        result.setCode(YunParkingConstant.SUCCESS);
        result.setMsg(YunParkingConstant.RETRUE_MSG_SUCCESS);
        return result;
    }

    public static <T> Result<T> success(String msg) {
        Result<T> result = new Result<>();
        result.setCode(YunParkingConstant.SUCCESS);
        result.setMsg(msg);
        return result;
    }

    public static <T> Result<T> success(String msg, T data) {
        Result<T> result = new Result<>();
        result.setCode(YunParkingConstant.SUCCESS);
        result.setData(data);
        result.setMsg(msg);
        return result;
    }


    public static <T> Result<T> error() {
        Result<T> result = new Result<>();
        result.setCode(YunParkingConstant.ERROR);
        result.setMsg(YunParkingConstant.RETRUE_MSG_ERROR);
        return result;
    }


    public static <T> Result<T> error(String msg) {
        Result<T> result = new Result<>();
        result.setCode(YunParkingConstant.ERROR);
        result.setMsg(msg);
        return result;
    }



}